<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <script>
    var buttonObj;
    window.onload = function (){
      buttonObj = document.getElementById("okButton");
      buttonObj.onclick = function (){
        alert("eee");
      }
    }

    function cancelClick(){
      buttonObj.onclick = null;
    }
  </script>
</head>
<body>
  <input type="button" value="确定" id="okButton"><br>
  <input type="button" value="取消" onclick="cancelClick()">

</body>
</html>
